#!/bin/bash             

cd step4
make > /dev/null 2>&1

chmod 777 main
./main > s
read ss < s
a=0
while read tmp 
 do
	if [ "$ss" == "$tmp" ] 
		then printf "yes" 
		a=1 
		break 
	fi
 done < answer.txt
if [ "$a" == 0 ]
	then printf "no"
fi
make clean > /dev/null 2>&1  


minNotesLen=200;
awk -v minNotesLen=$minNotesLen '{
  if(flag==1 && $NF!~"\\*/" ){
      content=content""$0      
    }
if($0~/problem-solving ideas:/){
   flag=1; 
   content=content""substr($0,index($0,"ideas:")+6)
   startLine=FNR;
}
if($NF~"\\*/"&&flag==1){
   endLine=FNR;
   content=content""substr($0,1,index($0,"*/")-1)
   gsub(" ","",content)
   len=length(content)
   if(len<minNotesLen&&flag==1){
       #printf("notes len:%d,from line %d to line:%d\n",len,startLine,endLine);
       print("请在problem-solving ideas:后写下详细的解题思路！");
}
flag=0;
}
}' main.c   
    